import request from '@/config/axios'

export interface AssetVO {
  id: string
  categoryId: string
  categoryCode: string
  businessCode: string
  procId: string
  status: string
  batchCode: string
  ownerCode: string
  assetCode: string
  assetStatus: string
  display: string
  cleanOutType: string
  cleanOut: string
  cleanTime: Date
  goodsId: string
  name: string
  manufacturerId: string
  model: string
  pictureId: string
  unit: string
  serviceLife: number
  safetyLevelCode: string
  serialNumber: string
  ownCompanyId: string
  managerId: string
  useOrganizationId: string
  useUserId: string
  regionId: string
  positionId: string
  positionDetail: string
  warehouseId: string
  goodsStockId: string
  sourceId: string
  assetNumber: number
  remainNumber: number
  purchaseDate: localdate
  productionDate: localdate
  registerDate: localdate
  rfid: string
  attach: string
  lastVerificationDate: localdate
  purpose: string
  assetNotes: string
  maintainerId: string
  maintainerName: string
  maintenanceStatus: string
  maintenancePrice: number
  maintenanceMethod: string
  suggestMaintenanceMethod: string
  contacts: string
  contactInformation: string
  director: string
  maintenanceStartDate: localdate
  maintenanceEndDate: localdate
  maintenanceNotes: string
  financialCategoryId: string
  financialCode: string
  financialOption: string
  expenseItem: string
  supplierId: string
  customerInfo: string
  taxAmountPrice: number
  totalAmountPrice: number
  purchaseUnitPrice: number
  originalUnitPrice: number
  navPrice: number
  assetUsedServiceLife: number
  depreciationId: string
  depreciationOperTime: Date
  residualsRate: number
  residualsPrice: number
  taxAmountRate: number
  currentYearDepreciation: number
  depreciationYear: number
  accumulatedDepreciation: number
  monthDepreciationPrice: number
  entryTime: Date
  financialNotes: string
  equipmentCode: string
  equipmentStatus: string
  equipmentIp: string
  manageIp: string
  equipmentCpu: string
  equipmentMemory: string
  equipmentLabel: string
  equipmentConf: string
  equipmentEnvironmentCode: string
  equipmentSerialNumber: string
  rackId: string
  rackUpNumber: number
  rackDownNumber: number
  label: string
  label3: string
  label5: string
  label4: string
  label2: string
  billId: string
  lastInspectTime: Date
  longitude: number
  dimension: number
  internalControlLabel: string
  collectionId: string
  borrowId: string
  scrapId: string
  handleId: string
  originatorId: string
  chsType: string
  chsStatus: string
  chsVersion: string
  changeInstanceId: string
  summary: string
  latestApproverId: string
  latestApproverName: string
  nextApproverIds: string
  nextApproverNames: string
  approvalOpinion: string
  assetSelectedData: string
}

// 查询资产分页
export const getAssetPage = async (params) => {
  return await request.get({ url: `/eam/asset/page`, params })
}

// 查询资产详情
export const getAsset = async (id: number) => {
  return await request.get({ url: `/eam/asset/get?id=` + id })
}

// 新增资产
export const createAsset = async (data: AssetVO) => {
  return await request.post({ url: `/eam/asset/create`, data })
}

// 修改资产
export const updateAsset = async (data: any) => {
  return await request.put({ url: `/eam/asset/update`, data })
}

// 删除资产
export const deleteAsset = async (id: number) => {
  return await request.delete({ url: `/eam/asset/delete?id=` + id })
}

// 导出资产 Excel
export const exportAsset = async (params) => {
  return await request.download({ url: `/eam/asset/export-excel`, params })
}
